<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<%@ include file="/commons/head.jsp" %>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <%@ include file="/commons/left.jsp" %>
    <div class="content-wrapper">
        <section class="content-header">
            <h1>
                企业信息
            </h1>
        </section>
        <div class="content">
            <div class="row">
                <div class="col-md-9">
                    <div class="box box-primary" style="overflow:hidden">
                        <form id="postForm" enctype="multipart/form-data" class="form-horizontal" autocomplete="off">
                            <input type="hidden" name="Id" value="${entity.id}">
                            <div class="box-body" style="padding-top:30px">
                                <div class="form-group">
                                    <label for="selectIndustryId" class="col-sm-2 control-label">行业：</label>
                                    <div class="col-sm-3">
                                        <select class="form-control select2 select2-hidden-accessible"
                                                id="selectIndustryId"
                                                style="width: 100%;" tabindex="-1" aria-hidden="true" name="industryId">
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="selectAreaId" class="col-sm-2 control-label">区域：</label>
                                    <div class="col-sm-3">
                                        <select class="form-control select2 select2-hidden-accessible" id="selectAreaId"
                                                style="width: 100%;" tabindex="-1" aria-hidden="true" name="areaId">

                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="inputEnterpriseName" class="col-sm-2 control-label">企业名称：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off"
                                               id="inputEnterpriseName"
                                               name="enterpriseName" value="${entity.enterpriseName}"
                                               placeholder="企业名称">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="inputEnterpriseCode" class="col-sm-2 control-label">注册号：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off"
                                               id="inputEnterpriseCode"
                                               name="enterpriseCode" value="${entity.enterpriseCode}"
                                               placeholder="注册号">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="inputCreditCode" class="col-sm-2 control-label">企业信用代码：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="inputCreditCode"
                                               name="creditCode" value="${entity.creditCode}" placeholder="企业信用代码">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="inputRegisteCapital" class="col-sm-2 control-label">注册资本：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off"
                                               id="inputRegisteCapital"
                                               name="registeCapital" value="${entity.registeCapital}"
                                               placeholder="注册资本">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="inputBusinessTerm" class="col-sm-2 control-label">营业期限：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off"
                                               id="inputBusinessTerm"
                                               name="businessTerm" value="${entity.businessTerm}" placeholder="营业期限">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="categoryType" class="col-sm-2 control-label">类别：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="categoryType"
                                               name="categoryType" value="${entity.categoryType}" placeholder="类别">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="inputBrandName" class="col-sm-2 control-label">商标名称：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="inputBrandName"
                                               name="brandName" value="${entity.brandName}" placeholder="商标名称">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="inputCorporation" class="col-sm-2 control-label">法人：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="inputCorporation"
                                               name="corporation" value="${entity.corporation}" placeholder="法人">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="inputCorporationPhone" class="col-sm-2 control-label">法人联系电话：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off"
                                               id="inputCorporationPhone"
                                               name="corporationPhone" value="${entity.corporationPhone}"
                                               placeholder="法人联系电话">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="inputContact" class="col-sm-2 control-label">联系人：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="inputContact"
                                               name="contact" value="${entity.contact}" placeholder="联系人">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="inputContactphone" class="col-sm-2 control-label">联系人联系电话：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off"
                                               id="inputContactphone"
                                               name="contactphone" value="${entity.contactphone}" placeholder="联系人联系电话">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="logo" class="col-sm-2 control-label">LOGO</label>
                                    <div class="col-sm-5"><input id="logo" name="logo" type="file"
                                                                 accept="image/*"
                                                                 style="margin-top: 5px;"></div>
                                </div>
                                <div class="form-group">
                                    <label for="inputEnterProfile" class="col-sm-2 control-label">企业概况</label>
                                    <div class="col-sm-5">
                                        <textarea class="form-control" autocomplete="off" id="inputEnterProfile"
                                                  name="enterProfile" placeholder="企业概况">${item.enterProfile}</textarea>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="inputPhone" class="col-sm-2 control-label">公司电话：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="inputPhone"
                                               name="phone" value="${entity.phone}" placeholder="公司电话">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="inputAddress" class="col-sm-2 control-label">公司地址：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="inputAddress"
                                               name="address" value="${entity.address}" placeholder="公司地址">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="inputPhone" class="col-sm-2 control-label">企业官网：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="inputSiteUrl"
                                               name="siteUrl" value="${entity.siteUrl}" placeholder="企业官网">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="multipartFile2" class="col-sm-2 control-label">公众号二维码</label>
                                    <div class="col-sm-5"><input id="multipartFile2" name="multipartFile" type="file"
                                                                 accept="image/*"
                                                                 style="margin-top: 5px;"></div>
                                </div>
                                <div class="form-group">
                                    <label for="selectIsStatis" class="col-sm-2 control-label">状态：</label>
                                    <div class="col-sm-3">
                                        <select class="form-control select2 select2-hidden-accessible"
                                                id="selectIsStatis"
                                                style="width: 100%;" tabindex="-1" aria-hidden="true" name="isStatis">
                                            <option value="0" <c:if test="${0 == entity.isStatis}">selected="selected"</c:if>>禁用</option>
                                            <option value="1" <c:if test="${1 == entity.isStatis}">selected="selected"</c:if>>启用</option>
                                            <option value="2" <c:if test="${2 == entity.isStatis}">selected="selected"</c:if>>推荐</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="content" class="col-sm-2 control-label">详细内容</label>
                                    <div class="col-sm-5">
                                        <script type="text/plain" id="content"
                                                name="content">${entity.content}</script>
                                    </div>
                                </div>
                            </div>
                            <div class="box-footer">
                                <div class="col-sm-2"></div>
                                <button type="button" class="btn btn-info" onclick="submitForm()">提交</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <%@ include file="/commons/script.jsp" %>
    <script type="text/javascript" src="${ctx}/dist/js/jquery.form.js"></script>
    <script charset="utf-8" src="${ctx}/ueditor/ueditor.config.js"></script>
    <script charset="utf-8" src="${ctx}/ueditor/ueditor.all.min.js"></script>
    <script charset="utf-8" src="${ctx}/ueditor/lang/zh-cn/zh-cn.js"></script>
    <script type="text/javascript">
        var ue = UE.getEditor('content',{
            initialFrameWidth:700,
            initialFrameHeight:300,
            wordCount:true,
            elementPathEnabled:false
        });

        function submitForm() {
            var id = $('#postForm').find('input[name=Id]').val();
            var url = null;
            if (id == null || id == "") {
                url = "${ctx}/enterprise/saveEnterprise?action=add";
            } else {
                url = "${ctx}/enterprise/saveEnterprise?action=update";
            }
            $("#postForm").ajaxSubmit({
                cache: false,
                type: "post",
                url: url,
                error: function () {
                    alert("系统异常");
                },
                success: function (data) {
                    if (data !== null) {
                        if (data == 0) {
                            //修改失败
                            alert('失败');
                        } else {
                            //添加/修改成功
                            alert('成功');
                            window.location.href = "${ctx}/enterprise/listEnterprise";
                        }
                    }
                }
            });
        }
    </script>
</body>
</html>
